<?php if (!defined('THINK_PATH')) exit(); /*a:4:{s:82:"D:\PHPTutorial\WWW\ERP\public/../application/admin\view\bomlists\bomlist\edit.html";i:1574320246;s:65:"D:\PHPTutorial\WWW\ERP\application\admin\view\layout\default.html";i:1574218857;s:62:"D:\PHPTutorial\WWW\ERP\application\admin\view\common\meta.html";i:1574218857;s:64:"D:\PHPTutorial\WWW\ERP\application\admin\view\common\script.html";i:1574218857;}*/ ?>
<!DOCTYPE html>
<html lang="<?php echo $config['language']; ?>">
    <head>
        <meta charset="utf-8">
<title><?php echo (isset($title) && ($title !== '')?$title:''); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="renderer" content="webkit">

<link rel="shortcut icon" href="/public/assets/img/favicon.ico" />
<!-- Loading Bootstrap -->
<link href="/public/assets/css/backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.css?v=<?php echo \think\Config::get('site.version'); ?>" rel="stylesheet">

<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
  <script src="/public/assets/js/html5shiv.js"></script>
  <script src="/public/assets/js/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
    var require = {
        config:  <?php echo json_encode($config); ?>
    };
</script>
    </head>

    <body class="inside-header inside-aside <?php echo defined('IS_DIALOG') && IS_DIALOG ? 'is-dialog' : ''; ?>">
        <div id="main" role="main">
            <div class="tab-content tab-addtabs">
                <div id="content">
                    <div class="row">
                        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                            <section class="content-header hide">
                                <h1>
                                    <?php echo __('Dashboard'); ?>
                                    <small><?php echo __('Control panel'); ?></small>
                                </h1>
                            </section>
                            <?php if(!IS_DIALOG && !$config['fastadmin']['multiplenav']): ?>
                            <!-- RIBBON -->
                            <div id="ribbon">
                                <ol class="breadcrumb pull-left">
                                    <li><a href="dashboard" class="addtabsit"><i class="fa fa-dashboard"></i> <?php echo __('Dashboard'); ?></a></li>
                                </ol>
                                <ol class="breadcrumb pull-right">
                                    <?php foreach($breadcrumb as $vo): ?>
                                    <li><a href="javascript:;" data-url="<?php echo $vo['url']; ?>"><?php echo $vo['title']; ?></a></li>
                                    <?php endforeach; ?>
                                </ol>
                            </div>
                            <!-- END RIBBON -->
                            <?php endif; ?>
                            <div class="content">
                                <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('P_bn'); ?>:</label>
        <div class="col-xs-12 col-sm-8">
            <a data-url="product_lists/products?status=radio" href="#"  class="btn btn-success btn-ajaxss"  data-title="选择产品" id="choose_product" ><?php echo htmlentities($list['name']); ?></a>
            <input type="hidden" id="product" name="row[product]" value="<?php echo htmlentities($list['p_bn']); ?>">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('Status'); ?>:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="radio">
                <?php if(is_array($statusList) || $statusList instanceof \think\Collection || $statusList instanceof \think\Paginator): if( count($statusList)==0 ) : echo "" ;else: foreach($statusList as $key=>$vo): ?>
                <label for="row[status]-<?php echo $key; ?>"><input id="row[status]-<?php echo $key; ?>" name="row[status]" type="radio" value="<?php echo $key; ?>" <?php if(in_array(($key), is_array($list['status'])?$list['status']:explode(',',$list['status']))): ?>checked<?php endif; ?> /> <?php echo $vo; ?></label>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </div>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"><?php echo __('C_bn'); ?>:</label>
        <div class="col-xs-12 col-sm-8">
            <a data-url="product_lists/products?status=check" href="#"  class="btn btn-success btn-ajaxs"  data-title="选择产品" id="choose_products">选择产品</a>
        </div>
    </div>
    <div class="form-group" style="overflow:scroll;">
        <table id="pro_table" class="table table-striped table-bordered table-hover table-nowrap">
            <thead>
            <tr>
                <th>操作</th>
                <th>产品编码</th>
                <th>产品名称</th>
                <th>产品规格</th>
                <th>单位</th>
                <th>获取途径</th>
                <th>标准用量</th>
            </tr>
            </thead>
            <tbody id="MyPublishShow">

            </tbody>
        </table>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled"><?php echo __('OK'); ?></button>
            <button type="reset" class="btn btn-default btn-embossed"><?php echo __('Reset'); ?></button>
        </div>
    </div>
</form>
<script>
    function delete_one(obj){
        if(obj.name == 'edit'){
            var index = $(obj).parents("tr").index();
            $(obj).parents("tr").remove(); //实现删除tr
        }else{
            layer.msg('是否删除本条数据？', {
                time: 0 //不自动关闭
                ,btn: ['是', '否']
                ,yes: function(index){
                    Fast.api.ajax({
                        url: 'bomlists/bomlist/func_del',
                        data: {
                            ids: obj.id
                        }
                    }, function (data, ret) {
                        var index = $(obj).parents("tr").index();
                        $(obj).parents("tr").remove(); //实现删除tr
                    }, function (data, ret) {
                        layer.alert(ret.msg);
                        return false;
                    });
                    layer.close(index);
                }
            });
        }



    }
    function edit_one(obj){
        var url = obj.getAttribute('data-url');
        if(!url) return false;
        var msg = obj.getAttribute('data-title');
        var width = obj.getAttribute('data-width');
        var height = obj.getAttribute('data-height');
        var area = ['80%', '80%'];
        var options = {
            shadeClose: false,
            shade: [0.3, '#393D49'],
            area: area,
            callback:function(value){
                if(value){
                    for (i = 0; i < value.length; i++) {
                        $("#MyPublishShow").append("<tr><td>" +
                                "<a href='#' onclick='delete_one(this);' id='"+value[i].bn+"' name='edit' class='btn btn-danger btn-del' ><i class='fa fa-trash'></i> 删除</a>"+
                                "</td><td>"+value[i].bn+
                                "</td><td>"+value[i].name+
                                "</td><td>"+value[i].spec+
                                "</td><td>"+"<input type='text' name='products["+value[i].bn+"][unit]' value='"+value[i].unit+"'>"+
                                "</td><td>"+value[i].access_text+
                                "</td><td>"+"<input type='text' name='products["+value[i].bn+"][Dosage]'>"+
                                "</td></tr>");
                    }

                }else{
                    Layer.alert('请选择一个产品');
                }
            }
        };
        parent.Fast.api.open(url,msg,options);
    }
</script>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script src="/public/assets/js/require<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js" data-main="/public/assets/js/require-backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js?v=<?php echo htmlentities($site['version']); ?>"></script>
    </body>
</html>